package com.ke.searchhouse.controller.user;

import com.ke.searchhouse.base.Response;
import com.ke.searchhouse.service.ISmsService;
import com.ke.searchhouse.util.ServiceResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class SmsController {

    @Autowired
    private ISmsService smsService;

    @RequestMapping("/sms/code")
    @ResponseBody
    public Response smsCode(@RequestParam("telephone") String telephone) {
        ServiceResult<String> res = smsService.sendSms(telephone);

        return Response.ofSuccess(res.getResult());
    }

}
